home *** CD-ROM | disk | FTP | other *** search
- // ===============================================================
- // Fragment Program: mutant refraction
- // Description: used in mutant stealth refraction
- // Last Update: 29/09/2003
- // Coder: Tiago Sousa
- // ===============================================================
-
-
- #include "../CGVPMacro.csi"
-
- MainInput
- {
- uniform sampler2D baseMap : texunit0,
- #ifdef OPENGL
- uniform samplerRECT refMap : texunit1,
- #endif
- #ifdef D3D
- uniform sampler2D refMap : texunit1,
- #endif
- uniform float4 Matrix
- }
-
- DeclarationsScript
- {
- OUT_T0_T1_C0
- FOUT
- }
-
- CoreScript
- {
- // load the decal
- float4 bumpColor = tex2D(baseMap, IN.Tex0.xy);
- //float4 refrColor = tex2D(refMap, IN.Tex1.xy);
-
- // must create 2 versions, since offsetRECT/samplerRECT must be used for gl version...
- #ifdef D3D
-
- #ifdef PROFILE_PS_1_1
- float4 refrColor = offsettex2D(refMap, IN.Tex1.xy, bumpColor, Matrix); // get env bump map
- #endif
-
- #ifdef OTHER
- float2 newst = IN.Tex1.xy + Matrix.xy * bumpColor.xx + Matrix.zw * bumpColor.yy;
- float4 refrColor = tex2D(refMap, newst);
- #endif
-
- #endif
-
- #ifdef OPENGL
- float4 refrColor = offsettexRECT(refMap, IN.Tex1.xy, bumpColor, Matrix); // get env bump map
- #endif
-
- OUT.Color.xyz = saturate(refrColor.xyz+refrColor.xyz*0.1);
- OUT.Color.a = IN.Color.w;
- }